package com.huilian.iotbox.admin.controller;

import com.huilian.iotbox.admin.service.DisplayRackItemService;
import com.huilian.iotbox.admin.service.UserService;
import com.huilian.iotbox.data.common.ServerResponse;
import com.huilian.iotbox.data.controller.BaseController;
import com.huilian.iotbox.data.dto.DisplayRackItemDto;
import com.huilian.iotbox.data.vo.UserInfo;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;


@RestController
@RequestMapping("/api/displayRackItem")
public class DisplayRackItemController extends BaseController {

    @Resource
    private UserService userService;

    @Resource
    private DisplayRackItemService displayRackService;

    @PostMapping("/updateDeviceTypeId")
    public ServerResponse updateDeviceTypeId(HttpServletRequest request , @RequestBody DisplayRackItemDto displayRackItemDto)  {
        UserInfo userInfo = userService.getLoginUserInfo(request);
        displayRackItemDto.setUserInfo(userInfo);
        return displayRackService.updateDeviceTypeId(displayRackItemDto);
    }

}
